<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('报销列表')" />
    <link rel="stylesheet" href="../../../../../../../../../../../../css/navigation.css">
</head>
<body class="gray-bg">
<div class="navigation visible-xs-block">
    <ol class="breadcrumb">
        <span> > </span>
        <li><a href="#" onclick="gomain()">主页</a></li>
        <li style="color: black">报销</li>
    </ol>
    <div class="aLine"></div>
</div>
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>报销类型：</label>
                            <select name="eType" th:with="type=${@dict.getType('expense_eType')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label>申请人：</label>
                            <input type="text" name="eTheHeir"/>
                        </li>
<!--                        <li>-->
<!--                            <label>报销原因：</label>-->
<!--                            <input type="text" name="eReason"/>-->
<!--                        </li>-->
                        <li class="select-time">
                            <label>申请时间：</label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginETimeStart]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endETimeStart]"/>
                        </li>
<!--                        <li>-->
<!--                            <label>报销金额：</label>-->
<!--                            <input type="text" name="eMoney"/>-->
<!--                        </li>-->

<!--                        <li>-->
<!--                            <label>报销状态：</label>-->
<!--                            <select name="eStatus" th:with="type=${@dict.getType('exa_expense_stutas')}">-->
<!--                                <option value="">所有</option>-->
<!--                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}">-->
<!--                                </option>-->
<!--                            </select>-->
<!--                        </li>-->

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">

            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="ruoyi:expense:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script src="../../../../../../../../../../../../js/breadcrumb.js"></script>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('ruoyi:expense:edit')}]];
    var removeFlag = [[${@permission.hasPermi('ruoyi:expense:remove')}]];
    var prefix = ctx + "ruoyi/expenses";
    var eStatus = [[${@dict.getType('exa_expense_stutas')}]];
    var eType = [[${@dict.getType('expense_eType')}]];

    $(function() {
        var options = {
            url: prefix + "/list",
            exportUrl: prefix + "/export",
            showFooter: true,
            sortName:'eTimeStart',
            sortOrder:'desc',
            striped: true,
            showColumns: false,
            onLoadSuccess: onLoadSuccess,
            modalName: "报销列表",
            columns: [
                {
                    field: 'eId',
                    title: '报销单主键',
                    visible: false
                },
                {
                    field: 'eTheHeir',
                    title: '申请人'
                },
                {
                    field: 'eType',
                    title: '报销类型	',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(eType, value);
                    }
                },
                {
                    field: 'eReason',
                    title: '报销原因'
                },
                {
                    // field: 'eMoney',
                    title: '报销金额',
                    formatter: function (value, row, index) {
                        var eMoney = [];
                        eMoney.push('￥'+row.eMoney)
                        return eMoney.join('');
                    },
                    footerFormatter: function(value){
                        var sum = 0;
                        for (var i in value) {
                            sum += parseFloat(value[i].eMoney)
                        }
                        return "报销总费用: ￥"+sum;
                    }
                },
                {
                    field: 'eTimeStart',
                    title: '报销申请时间',
                    sortable: true //排序
                },
                {
                    field: 'eRemark',
                    title: '文件上传凭证',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return $.table.imageView(value);
                    }
                },
                {
                    field: 'eStatus',
                    title: '报销状态',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(eStatus, value);
                    }
                },
                {
                    field: 'eOpinion',
                      title: '审批意见'
                }]
        };
        $.table.init(options);
    });
    function onLoadSuccess() {
        $(".fixed-table-body").on("scroll",function(){
            var sl=this.scrollLeft;
            $(this).next()[0].scrollLeft = sl;
        })
    }
</script>
</body>
</html>